package com.bootdo.system.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bootdo.common.utils.DateUtils;
import com.bootdo.system.domain.TbWithdrawal;
import com.bootdo.system.domain.TbWxmessage;
import com.bootdo.system.mapper.TbWxmessageMapper;
import com.bootdo.system.service.MsgService;


@Service
public class MsgServiceImpl implements MsgService{
	
	@Autowired
	private TbWxmessageMapper wm;

	@Override
	public List<TbWxmessage> wxMsgList(Map<String, Object> map) {
		return wm.list(map);
	}


	@Override
	public int count(Map<String, Object> map) {
		return wm.count(map);
	}

	@Override
	public int insert2update(TbWxmessage table) {
		int res=0;
		if(table != null) {
			Integer id = table.getId();
			if(id != null) {
				table.setUpdatetime(DateUtils.format(new Date()));
				res=wm.updateByPrimaryKeySelective(table);
			}else {
				table.setCreatetime(DateUtils.format(new Date()));
				res=wm.insertSelective(table);
			}
		}
		return res;
	}


	@Override
	public int remove(Integer id) {
		return wm.deleteByPrimaryKey(id);
	}


	@Override
	public int batchremove(Integer[] ids) {
		int res=0;
		if(ids.length > 0) {
			for (int i = 0; i < ids.length; i++) {
				res=wm.deleteByPrimaryKey(ids[i]);
			}
		}
		return res;
	}

}
